1. Field of the Invention
The present invention relates to debugging hardware description language (HDL) code. Specifically, the present invention discloses a system and method that utilizes an active code tracing strategy to help a user locate faulty circuit designs.
2. Description of the Prior Art
With the gate counts and system complexity of circuit designs growing exponentially, engineers are spending more and more time on functional debugging. Debugging is now recognized as a critical step in the entire design and compilation process of complex circuitry. Indeed, the cost of debugging often dominates all other design expenses.
Hardware description languages (HDLs) are used to describe and model complex circuits, as debugging HDL code is considerably more efficient than the traditional methods of circuit schematics or in-circuit emulators. To date, however, it is the software industry that has presented the most comprehensive treatment of debugging. Little has been done in the hardware domain to address the debugging of ASICs and processors, even though such systems can be in excess of 10 million gates, and have correspondingly complex HDL code.
Engineers typically use HDL code to run simulations on a circuit design. Simulation results are compared to the design specifications to find any deviations. If any such deviations are found, the engineer must manually trace through the HDL source code to find the offending code that is responsible for the design flaw. This debugging process can be very difficult and tedious, especially if the engineer doing the debugging did not design the circuit. Although detecting the source of bugs is of critical importance, few methods have been proposed to assist an engineer in this task.
One of the simplest and most common methods for finding bugs is tracing. Please refer to FIG. 1 and FIG. 2. FIG. 1 is a diagram of a portion of a circuit 10. The diagram is presented to a user on a computer display as part of an HDL design package, and is a graphical representation of HDL source code that describes the circuit 10. FIG. 2 shows sample HDL source code for the circuit portion 10 of FIG. 1.
A circuit simulator (not shown) uses the portion of HDL source code 20, and a great deal of other code as well, to generate circuit timing data. In particular, the simulator will yield timing data for the circuit portion 10. By studying the timing data, an engineer may learn that the signal line n_dout112 goes into an improper state at a certain time. The engineer can click on the circuit portion 10, and the HDL design package will present the source code 20 in a different window on the display. To find the bug that is causing n_dout112 to go into an improper state, it is logical that the engineer exhaustively check every line of code that sets n_dout112. This is termed tracing. For example, if at a circuit execution time t=45, n_dout112 is equal to ALU 16, then, for the code 20, the engineer would know that line 22 is the line of code responsible for the state of n_dout112 at t=45. The engineer 30 must then determine if mux_sel 14 has an incorrect value of xe2x80x9c011xe2x80x9d at t=45, or if setting n_dout112 equal to ALU 16 is incorrect.
Although tracing in the tiny code fragment 20 is quite straightforward, the fact is that, in most circuit designs, hundreds of lines of code may be responsible for setting the state of n_dout112. That is, the line n_dout112 may be driven by many different signal lines at any given time, and hence there will be many different lines of source code that assign an assignment state to the element variable xe2x80x9cn_dout1xe2x80x9d 24. These lines of assignment can be scattered throughout the source code. Worse still, many of them may be identical. For example, there may be several lines of source code that state, xe2x80x98n_dout1=ALUxe2x80x99. It is up to the engineer to parse the nested structures of the source code to determine which line is actually responsible for setting the value of xe2x80x9cn_dout1xe2x80x9d 24, and thus the state of signal line n_dout112. In any sufficiently complex circuit design, this process can turn into an enormously tedious and time-consuming task.
It is therefore a primary objective of this invention to provide a method and system for performing an active trace function to assist in finding lines of source code that are responsible for the state of a signal at a certain execution time.
The present invention, briefly summarized, discloses a method and corresponding system for assisting with debugging hardware description language (HDL) code in a debugger on a computer system. The HDL code is used to describe a circuit. Circuit simulation data is obtained for the circuit, the simulation data being generated according to the HDL code. A circuit execution time is selected, and the simulation data should at least span the circuit execution time. A debugging element is selected, which is a circuit element in the circuit having a debugging state at the circuit execution time according to the simulation data. A target line of HDL code is then presented to a user. The target line of HDL code is the line of code responsible for setting the debugging element into the debugging state at the circuit execution time.
It is an advantage of the present invention that by presenting the target line of HDL source code, an engineer can more quickly trace and track down bugs in the HDL source code that describes a circuit. Overall debugging time requirements are therefore reduced.